import request from '@/utils/request'
//获取角色列表
export function getrolesList(){
  return request({
    url:'/roles',
    method:'get'


  })


}



//根据用户id获取用户的角色详情
export function getdetailRoles(id){

  return request({
    url:`/getrolesByUserId/${id}`,
    method:'get'

  })

}

//根据用户id设置角色

export function setUsersRoles(data){

  return request({
    url:'/setUserRoles',
    method:'put',
    data,


  })

}


//根据角色id删除角色
export function removeRolesByid(id){

  return request({
    url:`/roles/${id}`,
    method:'delete'


  })


}

//跟据角色id编辑角色信息

export function editRoles(id,data){

  return request({
    url:`/roles/${id}`,
    method:'put',
    data


  })
}
//根据角色id获取角色详情
export function getRolesDetail(id){

  return request({

    url: `/roles/${id}`,
    method:'get'
  })
}

//新增角色

export  function addRoles(data){
  return request({
    url:'roles',
    method:'post',
    data

  })


}

//根据角色id 给角色分配权限

export function  assignPerm(data){
return request({
  url:'/roles',
  method:'put',
  data


})

}
